#ifndef STRATEGYCONDITIONBASE_H
#define STRATEGYCONDITIONBASE_H
#include "src/Models/NormalDefectModels.h"
#include "src/Entity/clientdefect.h"

//判断缺陷时的五种不同条件 判断一级时存在的五种条件以及判断2,3级时的五种判断条件一样
class condtionDectectBase : public QObject{
    Q_OBJECT
public:
    virtual void execute(NormalDetectBase &, SteelInfo*,int) = 0;
};


class conditionContext:  public QObject{
    Q_OBJECT
public:
    void SetStrategy(condtionDectectBase* s){
        this->strategy = s;
    }

    void execute(NormalDetectBase & strategy,SteelInfo*steel,int lv){
        this->strategy->execute(strategy,steel,lv);
    }

private:
    condtionDectectBase *strategy;
};

/*

//正常判断
class NormalDetectStrategy : public condtionDectectBase{
    // condtionDectectBase interface
public:
    void execute(NormalDetectBase &, SteelInfo *, int);
};



//边部判断
class BesideDetectStrategy : public condtionDectectBase{
    // condtionDectectBase interface
public:
    void execute(NormalDetectBase &, SteelInfo *, int);
};




//频率判断
class FrequencyDetectStrategy : public condtionDectectBase{

public:
    void execute(NormalDetectBase &, SteelInfo *, int);

    //
    // * @brief 计算两个缺陷之间的距离
    // * @param 缺陷
    // * @param 下一个缺陷
    // * @return
    double calculateDistance(const ClientDefect& d1, const ClientDefect& d2)const;

    void calculateFrequence(QList<ClientDefect*> list, NormalDetectBase& NormalDetectBaset,SteelInfo *steel,int level,int camNo);
};



//长度判断:通卷率
class VerticalLengthDetectStrategy: public condtionDectectBase{

    // condtionDectectBase interface
public:
    void execute(NormalDetectBase &, SteelInfo *, int);


    //根据缺陷名称计算长度
    void calculateLengthByDefectName(QList<ClientDefect*>,NormalDetectBase & NormalDetectBase,SteelInfo *steel,int level);

};



//出现直接降级
class DirectDetectStrategy : public condtionDectectBase{

    // condtionDectectBase interface
public:
    void execute(NormalDetectBase &, SteelInfo *, int);
};

*/

#endif // STRATEGYCONDITIONBASE_H
